package com.smcdd.cdb.dbo.cdb_dbo.ui.activity;

import android.os.Build;
import android.widget.EditText;
import android.widget.TextView;

import com.smcdd.cdb.dbo.cdb_dbo.R;
import com.smcdd.cdb.dbo.cdb_dbo.service.presenter.LoginPresenter;
import com.smcdd.cdb.dbo.cdb_dbo.service.view.ILoginAc;
import com.smcdd.cdb.dbo.cdb_dbo.ui.base.BaseActivity;
import com.smcdd.cdb.dbo.cdb_dbo.ui.utils.ObtainUdis;

/**
 * 作者：Administrator on 2017/6/26 13:06
 * 邮箱：zhanghuaiha@gmail.com
 */

public class LoginActivity extends BaseActivity<ILoginAc,LoginPresenter> implements ILoginAc {
    private EditText ed_tell,ed_code;
    private TextView tv_codes,tv_login;

    @Override
    public void initView() {
        ed_tell = (EditText) findViewById(R.id.ed_tell);
        ed_code = (EditText) findViewById(R.id.ed_code);
        tv_codes = (TextView) findViewById(R.id.tv_codes);
        tv_login = (TextView) findViewById(R.id.tv_login);
        mPresenter.loadContacts();
    }

    @Override
    public void initData() {
        String udid = ObtainUdis.getUDID(LoginActivity.class);
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {

        }else {
            boolean b = ListPermission();
            if (!b) ListPermission();
        }

        mPresenter.getTel2Code(udid);


    }

    @Override
    protected LoginPresenter createPresenter() {
        return new LoginPresenter(this);
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_login;
    }

    @Override
    public EditText getTelET() {
        return ed_tell;
    }

    @Override
    public EditText getETCode() {
        return ed_code;
    }

    @Override
    public TextView getTV() {
        return tv_codes;
    }

    @Override
    public TextView getLogin() {
        return tv_login;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresenter.unLoadData();
    }
}
